import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/config/scene'
  },
  {
    path: '/chat-window',
    name: 'ChatWindow',
    component: () => import('@/components/ChatWindow.vue'),
    meta: { title: 'AI智能助手' }
  },
  {
    path: '/chat',
    name: 'Chat',
    component: () => import('@/components/ChatWindow.vue'),
    meta: { title: 'AI智能对话' }
  },
  {
    path: '/voice-call',
    name: 'VoiceCall',
    component: () => import('@/components/VoiceCallWindow.vue'),
    meta: { title: '语音通话' }
  },
  {
    path: '/video-call',
    name: 'VideoCall',
    component: () => import('@/components/VideoCallWindow.vue'),
    meta: { title: '视频聊天' }
  },
  {
    path: '/config',
    name: 'Config',
    component: () => import('@/views/Config.vue'),
    meta: { title: '系统配置' },
    children: [
      {
        path: 'scene',
        name: 'SceneManagement',
        component: () => import('@/views/config/SceneManagement.vue'),
        meta: { title: '场景管理' }
      },
      {
        path: 'dialog',
        name: 'DialogManagement',
        component: () => import('@/views/config/DialogManagement.vue'),
        meta: { title: 'AI助手管理' }
      },
      {
        path: 'memory',
        name: 'MemoryManagement',
        component: () => import('@/views/config/MemoryManagement.vue'),
        meta: { title: '记忆管理' }
      },
      {
        path: 'tools',
        name: 'ToolsManagement',
        component: () => import('@/views/config/ToolsManagement.vue'),
        meta: { title: '基础工具管理' }
      },
      {
        path: 'rag',
        name: 'RAGManagement',
        component: () => import('@/views/config/RAGManagement.vue'),
        meta: { title: 'Modular RAG管理' }
      },
      {
        path: 'rag-navigation',
        name: 'NavigationRAG',
        component: () => import('@/components/NavigationRAG.vue'),
        meta: { title: '导航RAG', parent: 'rag' }
      },
      {
        path: 'rag-document',
        name: 'DocumentRAG',
        component: () => import('@/components/DocumentRAG.vue'),
        meta: { title: '文档RAG', parent: 'rag' }
      },
      {
        path: 'agent',
        name: 'AgentManagement',
        component: () => import('@/views/config/AgentManagement.vue'),
        meta: { title: '智能体管理' }
      },
      {
        path: 'mcp',
        name: 'MCPManagement',
        component: () => import('@/views/config/MCPManagement.vue'),
        meta: { title: 'MCP接入管理' }
      },
      {
        path: 'permission',
        name: 'PermissionManagement',
        component: () => import('@/views/config/PermissionManagement.vue'),
        meta: { title: '接入权限管理' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router